package team.se.tms.util;

import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * 加密工具类
 *
 * @author winkyle
 * @date 2018/12/5
 */
@Slf4j
public class EncryptUtil {

    /**
     * 将传进来的密码通过sha1加密
     *
     * @param str 要加密的字符串
     * @param salt 盐，加密用的东西
     * @return 加密后的密码
     * @create on 2018/11/17 by winkyle
     */
    public static String sha1(String str, String salt){
        String credentials = new SimpleHash("SHA-1", str, salt, 2).toString();
        log.debug("salt:{}，credentials:{}，长度{}",salt,credentials,credentials.length());
        return credentials;
    }
}
